//
//  WLNavigationScrollViewModel.m
//  LookNovel
//
//  Created by chuangqi on 2021/3/8.
//  Copyright © 2021 cq Co.,ltd. All rights reserved.
//

#import "WLNavigationScrollViewModel.h"
#import "WLNavigationScrollView.h"

@implementation WLNavigationScrollViewModel
#pragma mark -- 导航数据
/** 获取导航栏视图展示模型 */
-(NSArray<WLBaseCollectionViewLayerSection *> *)getNavigationItem:(NSArray<WLNavigationScrollModel *> *)nav_list{
    WLBaseCollectionViewLayerSection *section = [[WLBaseCollectionViewLayerSection alloc]init];
    section.item = [NSMutableArray array];
    section.type = @"sectionnavInfo";
    section.insetForSection = self.insetForSection;
    section.verticalSection = self.verticalSection;
    section.horizontalSection = self.horizontalSection;
    
    //cell的高度
    CGFloat itemH = self.cellHeight - section.insetForSection.top - section.insetForSection.bottom;
    //当前cell的位置;
    CGFloat allItemindexW = section.insetForSection.left;
    for (WLNavigationScrollModel *model in nav_list) {//导航栏分类
        CGSize cellSize = [model getCellSizeHeight:itemH];
        model.offsetProgressCenterX = allItemindexW + cellSize.width/2;
        allItemindexW += (cellSize.width + section.verticalSection);
        [section.item addObject:[WLNavigationScrollViewCell getRow:model cellSize:cellSize]];
    }
    return @[section];
}
/** 初始化导航数据  */
-(void)initNavigationModelList:(NSArray <WLNavigationScrollModel *> *)navigationScrollModelList{
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(.1f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        self.nav_class_list = [NSMutableArray arrayWithArray:navigationScrollModelList];
        self.select_index = 0;
        self.offset_progress = 0;
    });
}
#pragma mark -- 内容视图数据



@end
